package com.oro.util;

import java.io.Serializable;
import java.util.Locale;

import javax.faces.context.FacesContext;

public class LanguageDetails implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3173534363796353016L;

	private String default_locale = "it";

	private String locale;

	public LanguageDetails() {
		locale = default_locale;
	}

	public String changeLanguage() {
		return "changed";
	}

	public String getLocale() {
		return locale;
	}

	public void setEnglish() {
		locale = "en";
		FacesContext.getCurrentInstance().getViewRoot()
				.setLocale(new Locale("en"));

	}

	public void setItalian() {
		locale = "it";
		FacesContext.getCurrentInstance().getViewRoot()
				.setLocale(new Locale("it"));

	}

	public void setLocale(String locale) {
		this.locale = locale;
		FacesContext.getCurrentInstance().getViewRoot()
				.setLocale(new Locale(locale));
	}

}
